package config.Item;

import player.entity.Repository;
import share.position.Position;

/**
 * 道具基类
 */
public class Item {
    private int id;             // 道具唯一ID
    private int type;           // 道具类型
    private String name;        // 道具名称
    private int width;          // 占用格子宽度
    private int height;         // 占用格子高度
    private boolean stackable;  // 是否可堆叠
    private int maxStack;       // 最大堆叠数量
    private int currentStack;   // 当前堆叠数量




    // 构造函数、getter和setter...

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public boolean isStackable() {
        return stackable;
    }

    public void setStackable(boolean stackable) {
        this.stackable = stackable;
    }

    public int getMaxStack() {
        return maxStack;
    }

    public void setMaxStack(int maxStack) {
        this.maxStack = maxStack;
    }

    public int getCurrentStack() {
        return currentStack;
    }

    public void setCurrentStack(int currentStack) {
        this.currentStack = currentStack;
    }

    /**
     * 是否可以与另一个道具堆叠
     */
    public boolean canStackWith(Item other) {
        return this.stackable && 
               this.type == other.type && 
               this.currentStack < this.maxStack;
    }



}